<!doctype html>
<html lang="en" ng-app="my-app">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../../../../../build/css/onsenui.css"/>
    <link rel="stylesheet" href="../../../../../build/css/onsen-css-components.css"/>

    <script src="../../../../../build/js/onsenui.js"></script>
    <script src="../../../../../node_modules/angular/angular.js"></script>
    <script src="../../../../../build/js/angular-onsenui.js"></script>
    <script>
      var module = angular.module('my-app', ['onsen']);

      var itWorked = false;

      document.addEventListener("ons-navigator:init", function(event) {
        var navigator = event.component;
        navigator.pushPage("page2.html");
        itWorked = true;
      });

      setTimeout(function() {
        if(!itWorked) {
          alert('NG');
        }
        else {
          alert('OK');
        }
      }, 1000);
    </script>

    <style>

    </style>
  </head>
  <body>

    <ons-navigator var="navi">
      <ons-page>
        <ons-toolbar>
          <div class="center">Page 1</div>
        </ons-toolbar>

        <p style="text-align: center;">
          <br>
          <ons-button ng-click="navi.pushPage('page2.html')">push</ons-button>
        </p>
      </ons-page>
    </ons-navigator>

    <script type="text/ons-template" id="page2.html">
      <ons-page>
        <ons-toolbar>
          <div class="left"><ons-back-button>Back</ons-back-button></div>
          <div class="center">Page 2</div>
        </ons-toolbar>
      </ons-page>
    </script>
   
  </body>
</html>
